package com.icss.users.vo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.icss.common.vo.BasePojo;

/**
 * 用户的pojo
 * @author 刘鑫
 */
public class ReUsers extends BasePojo<ReUsers>
{
	private int id;
	private String email;
	private String password;
	private String nick;
	private String name;
	private String phone;
	private byte userType ; 
	private double discount;
	private String address;
	private byte sex;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date lastLoginTime;

	private String statusStr;
	private String sexStr;
	private String userTypeStr ; 
	
	/* 存储所有状态的容器 */
	private Map<String,String> enumsMap = new TreeMap<String, String>();
	
	public Map<String, String> getEnumsMap()
	{
		// 根据状态值获取字符串描述
		ReUsersEnum[] usersEnums = ReUsersEnum.values();
		for (int i = 0; i < usersEnums.length; i++)
		{
			ReUsersEnum usersEnum = usersEnums[i];
			String key = usersEnum.toString() ; 
			enumsMap.put(key + "-" + usersEnum.getStatus() + "", usersEnum.getName());
		}
		return enumsMap;
	}

	public String getStatusStr()
	{
		ReUsersEnum[] values = ReUsersEnum.values();
		for (int i = 0; i < values.length; i++)
		{
			ReUsersEnum usersEnumTemp = values[i];
			/*
			 * toString:变量名 name:枚举的键, getstatus:枚举的值
			 */
			if (usersEnumTemp.toString().startsWith("STATUS"))
			{
				if (usersEnumTemp.getStatus() == this.status)
				{
					this.statusStr = usersEnumTemp.getName();
				}
			}
			// System.out.println(adminsEnumTemp.getName() + "=====>" +
			// adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return statusStr;
	}
	
	public String getSexStr()
	{
		ReUsersEnum[] values = ReUsersEnum.values();
		for (int i = 0; i < values.length; i++)
		{
			ReUsersEnum usersEnumTemp = values[i];
			/*
			 * toString:变量名 name:枚举的键, getstatus:枚举的值
			 */
			if (usersEnumTemp.toString().startsWith("SEX"))
			{
				if (usersEnumTemp.getStatus() == this.getSex())
				{
					this.sexStr = usersEnumTemp.getName();
				}
			}
			// System.out.println(adminsEnumTemp.getName() + "=====>" +
			// adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return sexStr;
	}
	
	public String getUserTypeStr()
	{
		ReUsersEnum[] values = ReUsersEnum.values();
		for (int i = 0; i < values.length; i++)
		{
			ReUsersEnum usersEnumTemp = values[i];
			/*
			 * toString:变量名 name:枚举的键, getstatus:枚举的值
			 */
			if (usersEnumTemp.toString().startsWith("USERTYPE_"))
			{
				if (usersEnumTemp.getStatus() == this.getUserType())
				{
					this.userTypeStr = usersEnumTemp.getName();
				}
			}
			// System.out.println(adminsEnumTemp.getName() + "=====>" +
			// adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return userTypeStr;
	}

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public String getEmail()
	{
		return email;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public String getNick()
	{
		return nick;
	}

	public void setNick(String nickName)
	{
		this.nick = nickName;
	}

	public String getName()
	{
		return name;
	}

	public void setTrueName(String trueName)
	{
		this.name = trueName;
	}

	public String getPhone()
	{
		return phone;
	}

	public void setPhone(String phone)
	{
		this.phone = phone;
	}

	public String getAddress()
	{
		return address;
	}

	public void setAddress(String address)
	{
		this.address = address;
	}

	public byte getSex()
	{
		return sex;
	}

	public void setSex(byte sex)
	{
		this.sex = sex;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getLastLoginTime()
	{
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime)
	{
		this.lastLoginTime = lastLoginTime;
	}

	public byte getUserType()
	{
		return userType;
	}

	public void setUserType(byte userType)
	{
		this.userType = userType;
	}

	public double getDiscount()
	{
		return discount;
	}

	public void setDiscount(double discount)
	{
		this.discount = discount;
	}
}
